import { createRouter, createWebHashHistory } from 'vue-router'
const routes = [
  {
    path: '/',
    component: () => import('@/views/layout'),
    children: [
      {
        path: '/',
        component: () => import('@/views/home')
      },
      {
        name: 'category',
        path: 'category/:id',
        component: () => import('@/views/category')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/login')
  }
]
// 创建路由实例
const router = createRouter({
  // 使用hash方式实现路由
  history: createWebHashHistory(),
  // 配置路由规则，写法和之前一样
  routes
})

export default router
